/*****************************************************************************
 * Name        : Feb17.cpp
 * Author      : Savitch
 * Version     : 2.0
 * Copyright   : You are free to use this code - it is from "Absolute C++" by Savitch
 * Description : main program for Money example from Chapter 8 of Savitch
******************************************************************************/

#include "Money.h"
/*
 * Operator overloading
 * - these are defined in Money.cpp
 */
const Money operator +(const Money& amount1, const Money& amount2);
const Money operator -(const Money& amount1, const Money& amount2);
bool operator ==(const Money& amount1, const Money& amount2);
const Money operator -(const Money& amount);


#include <iostream>
using namespace std;

int main() {
    Money yourAmount, myAmount(10, 9);
    cout << "Enter an amount of money: ";
    yourAmount.input( );

    cout << "Your amount is ";
    yourAmount.output( );
    cout << endl;
    cout << "My amount is ";
    myAmount.output( );
    cout << endl;

    if (yourAmount == myAmount)
        cout << "We have the same amounts.\n";
    else
        cout << "One of us is richer.\n";

    Money ourAmount = yourAmount + myAmount;
    yourAmount.output( ); cout << " + "; myAmount.output( );
    cout << " equals "; ourAmount.output( ); cout << endl;

    Money diffAmount = yourAmount - myAmount;
    yourAmount.output( ); cout << " - "; myAmount.output( );
    cout << " equals "; diffAmount.output( ); cout << endl;

    return 0;
}
